package T03_缩放图片;

import ag.script.project.standard.entity.AgAppConfig;
import ag.script.project.standard.core.ScreensDes;
import ag.script.project.standard.img.ImgScale;

import java.io.File;

public class Main {
    public static void main(String[] args) {
        //生成路径
        String path = "D:\\MyWorkspace\\Java\\ag-app-res\\ag-apps";
        AgAppConfig config = new AgAppConfig();
        config.setName("创造与魔法");
        config.setDevScreen("1080*?");//只存在宽度，那么所有图片缩放都按照宽度来缩放


        File file_project = new File(path, config.getAppNamePinyin());

        //图片路径
        String imgPath = "D:\\MyWorkspace\\Java\\ag-app-res\\ag-apps\\czymf\\res\\imgs\\w1080p\\创造与魔法.png";

        ScreensDes destScreenDes = new ScreensDes();
        destScreenDes.setName("720x");
        destScreenDes.setW(720);

        ScreensDes devScreenDes = config.getDevScreenDes();

        boolean scale = ImgScale.scale(file_project, imgPath, devScreenDes, destScreenDes);
        if (scale) {
            System.out.println("执行成功");
        } else {
            System.out.println("执行失败");
        }

    }
}
